$(document).ready(function() {
	var validator = $("#topicform").validate({
		rules: {
			biaoti: {
				required: true,
                                maxlength: 30,
				minlength: 1
			},
			terms: "required"
		},
		messages: {
			biaoti: {
				required: "请输入标题",
                                maxlength: jQuery.format("最多 {0} 个字符"),
				minlength: jQuery.format("最少 {0} 个字符")
			},
			//neirong: {
			//	required: "请输入话题内容",
			//	minlength: jQuery.format("请输入最少 {0} 个字符")
			//},
			terms: " "
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});

});

